package com.naiterui.ehp.bs.b2c.product.repository;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.query.Param;

import com.naiterui.common.repository.core.BaseJpaRepository;
import com.naiterui.ehp.bs.b2c.product.entity.CommonDrug;

/**
 * 医生常用药
 * 
 * @author yangfuya
 * @since 2022/3/29
 */
public interface ICommonDrugRepository extends BaseJpaRepository<CommonDrug, Long> {

    /**
     * 医生常用药分页列表
     * 
     * @param doctorId
     * @param pageable
     * @return
     */
    Page<CommonDrug> findAllByDoctorId(@Param("doctorId") Long doctorId, Pageable pageable);

    /**
     * 根据医生id查询该医生的常用药
     * 
     * @param doctorId
     * @return
     */
    List<CommonDrug> findCommonDrugByDoctorId(Long doctorId);

    /**
     * 根据医生id和药品id查询该药品是否添加为常用药
     * 
     * @param doctorId
     * @param productId
     * @return
     */
    CommonDrug findCommonDrugByDoctorIdAndProductId(Long doctorId, Long productId);
}
